package Song.Han.day07.demo05;

public class DemoMain {

    public static void main(String[] args) {

        Computer computer = new Computer();
        computer.powerOn();

        Mouse mouse = new Mouse();
        //直接传实现类也可以，自动转换为USB
        computer.useDevice(mouse);
        //向上转型
        USB usbMouse = mouse;
        computer.useDevice(usbMouse);

        //创建一个usb键盘(多态写法)
        USB usbKeyboard = new Keyboard();
        computer.useDevice(usbKeyboard);

        computer.powerOff();
    }
}
